package com.myweb.hadoop;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

/**
 * @author ZHOUTIEQIANG053 查看文件
 */
public class FileSystemCat {

	public static void main(String[] args) throws IOException {
		String url = args[0];
		Configuration conf = new Configuration();
		FileSystem fs = FileSystem.get(URI.create(url), conf);
		InputStream in = null;

		try {
			in = fs.open(new Path(url));
			org.apache.hadoop.io.IOUtils.copyBytes(in, System.out, 4096, false);
		} finally {
			org.apache.hadoop.io.IOUtils.closeStream(in);
		}

	}

}
